import re
# 题1: 匹配出叠字的亲戚, 如爷爷, 奶奶可通过, 姑妈不可通过.
text4_list = [
    'yeye',
    'nainai',
    'jiujiu',
    'guma',
    'yima',
    'baba',
]

# for text4 in text4_list:
#     regex = re.search(r'(\w+)(\1)', text4)
#     if regex:
#         print("匹配成功:", regex.group())
#     else:
#         print("匹配失败:", text4)

# 见图片. 面试题.jpg
test_string = "<a>测试</a><sub>测试测试</sub><sup>测试测试测试</sup><div>测试测</div><img>testtesttest</img>"
result = re.sub(r'(<?!<sub>).*(?!</sub>)','',test_string)
print(result)